package com.ruoyi.stock2.service.impl;

import java.util.Date;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.stock2.mapper.SearchFromEsMapper;
import com.ruoyi.stock2.domain.SearchFromEs;
import com.ruoyi.stock2.service.ISearchFromEsService;
import com.ruoyi.common.core.text.Convert;

/**
 * 从es中查询与模型相似股票Service业务层处理
 *
 * @author ruoyi
 * @date 2021-09-08
 */
@Service
public class SearchFromEsServiceImpl implements ISearchFromEsService
{
    @Autowired(required = false)
    private SearchFromEsMapper searchFromEsMapper;

    /**
     * 查询从es中查询与模型相似股票
     *
     * @param id 从es中查询与模型相似股票ID
     * @return 从es中查询与模型相似股票
     */
    @Override
    public SearchFromEs selectSearchFromEsById(Long id)
    {
        return searchFromEsMapper.selectSearchFromEsById(id);
    }

    /**
     * 查询从es中查询与模型相似股票列表
     *
     * @param searchFromEs 从es中查询与模型相似股票
     * @return 从es中查询与模型相似股票
     */
    @Override
    public List<SearchFromEs> selectSearchFromEsList(SearchFromEs searchFromEs)
    {
        return searchFromEsMapper.selectSearchFromEsList(searchFromEs);
    }

    /**
     * 新增从es中查询与模型相似股票
     *
     * @param searchFromEs 从es中查询与模型相似股票
     * @return 结果
     */
    @Override
    public int insertSearchFromEs(SearchFromEs searchFromEs)
    {
        return searchFromEsMapper.insertSearchFromEs(searchFromEs);
    }

    /**
     * 修改从es中查询与模型相似股票
     *
     * @param searchFromEs 从es中查询与模型相似股票
     * @return 结果
     */
    @Override
    public int updateSearchFromEs(SearchFromEs searchFromEs)
    {
        return searchFromEsMapper.updateSearchFromEs(searchFromEs);
    }

    /**
     * 删除从es中查询与模型相似股票对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteSearchFromEsByIds(String ids)
    {
        return searchFromEsMapper.deleteSearchFromEsByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除从es中查询与模型相似股票信息
     *
     * @param id 从es中查询与模型相似股票ID
     * @return 结果
     */
    @Override
    public int deleteSearchFromEsById(Long id)
    {
        return searchFromEsMapper.deleteSearchFromEsById(id);
    }

    @Override
    public Map<String, Long> selectModelikeCount(SearchFromEs searchFromEs) {
        return searchFromEsMapper.selectModelikeCount(searchFromEs);
    }

    @Override
    public List<Map<String, Object>> selectIndustryCount(SearchFromEs searchFromEs) {
        return searchFromEsMapper.selectIndustryCount(searchFromEs);
    }

    @Override
    public List<Map<String, Object>> selectChooseCount(SearchFromEs searchFromEs) {
        return searchFromEsMapper.selectChooseCount(searchFromEs);
    }

    @Override
    public int deleteSearchFromEsByDate(Date createDate) {
        return searchFromEsMapper.deleteSearchFromEsByByDate(createDate);
    }
}
